#include <vector>
#include <algorithm>

using namespace std;

class Node
{
public:
    int val;
    vector<Node *> children;

    Node() {}

    Node(int _val)
    {
        val = _val;
    }

    Node(int _val, vector<Node *> _children)
    {
        val = _val;
        children = _children;
    }
};

class Solution {
public:
    int maxDepth(Node* root) 
    {
        int Max = 0;
        if(root == nullptr)
        {
            return 0;
        }    

        for (int i = 0; i < root->children.size();++i)
        {
            int height = maxDepth(root->children[i]);
            Max = max(height, Max);
        }
        return Max + 1;
    }
};